<template>
  <el-card style="width: 500px">
    <el-form
      :model="ruleForm"
      label-width="80px"
      size="small"
      :rules="rules"
      class="demo-ruleForm"
    >
      <el-form-item label="原密码:">
        <el-input v-model="ruleForm.ypassword" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="新密码:">
        <el-input v-model="ruleForm.newpassword" autocomplete="off"></el-input>
      </el-form-item>
      <el-form-item label="确认密码:">
        <el-input
          v-model="ruleForm.enterpassword"
          autocomplete="off"
        ></el-input>
      </el-form-item>
      <el-button type="primary" @click="save" style="margin-left: 80px"
        >确 定</el-button
      >
    </el-form>
  </el-card>
</template>
<script>
export default {
  name: "Password",
  data() {
    return {
      user: localStorage.getItem("user")
        ? JSON.parse(localStorage.getItem("user"))
        : {},
      ruleForm: {
        ypassword: "",
        newpassword: "",
        enterpassword: "",
      },
      rules: {
        ypassword: [
          { required: true, message: "请输入原密码", trigger: "blur" },
        ],
        newpassword: [
          { required: true, message: "请输入新密码", trigger: "blur" },
        ],
        enterpassword: [
          { required: true, message: "请输入确定的密码", trigger: "blur" },
        ],
      },
    };
  },
};
</script>
<style scoped>
.red_star {
  color: #ff3b30;
  vertical-align: middle;
}
</style>
